<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    use HasFactory;


    protected $guarded = [];

    protected $casts = [
        'fields' => 'array'
    ];

    /**
     * 栏目关联
     */
    public function categories()
    {
        return $this->hasMany(Category::class);
    }

    /**
     * 文章关联
     * @return HasMany
     */
    public function contents()
    {
        return $this->hasMany(Content::class);
    }
}
